median of a list in python

31

import math
list = [ 1 ,9, 4,5,3]
list.sort()
middle_index= len(list)/2
exact_middle_index = math.floor(middle_index)
median_value = list[exact_middle_index]
print(median_value) 

Comments

Submit
0 Comments